package tech.aistar.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tech.aistar.entity.dynamic.PrisePic;

/**
 * @author Ace
 * @version 1.0
 * @descriiption:本类用来演示:
 * @date 2019/10/14 0014.
 */
public interface IPrisePicMapper {
    //根据picture表的id统计点赞的个数
    @Select("select count(*) from prise_pic where pic_id=#{value}")
    Integer countPriseByPic(Integer picId);

    @Select("select * from prise_pic where pic_id=#{pid} and user_id=#{uid}")
    PrisePic findByPidByUid(@Param("pid") Integer pid, @Param("uid") Integer uid);

    @Insert("insert into prise_pic(pic_id,user_id)values(#{picId},#{userId})")
    void insertAll(PrisePic prisePic);

    @Delete("delete from prise_pic where pic_id=#{pid} and user_id=#{uid}")
    void delByPidByUid(@Param("pid") Integer pid, @Param("uid") Integer uid);
}
